using System;
using System.Xml.Serialization;
using Jaws.Core.Web.Data;

namespace Jaws.Core.Web.Entities.SiteSettings
{
    [Serializable]
    [XmlDataDirectory("sitesettings")]
    public class SiteSettings : XmlBusinessBase<SiteSettings>
    {
        public SiteSettings()
        {
        }

        public string TrackingScript { get; set; }

        public string HtmlHeader { get; set; }

        public string SiteName { get; set; }

        public string Theme { get; set; }

        public string AlternateFeedUrl { get; set; }

        public string SmtpServer { get; set; }

        public string SmtpUserName { get; set; }

        public int SmtpServerPort { get; set; }

        public string SmtpPassword { get; set; }

        public bool EnableSsl { get; set; }

        [XmlIgnore]
        public string AdministratorRole
        {
            get { return "Admin"; }
        }

        public double Timezone { get; set; }

        public bool RequireSSLMetaWeblogAPI { get; set; }

        public static SiteSettings Instance()
        {
            SiteSettingCollection siteSettingsCollection = XmlCollectionBase<SiteSettingCollection, SiteSettings>.Load();
            return siteSettingsCollection[0];
        }

        public string DataStoragePath()
        {
            return string.Format("{0}", AppDomain.CurrentDomain.GetData("DataDirectory").ToString());
        }


    }
}